package com.topscore.uke.mvp.presenters;

import com.topscore.uke.entities.MemberBodyData;
import com.topscore.uke.mvp.contractors.GetMemberBodyDataContractor;
import com.topscore.uke.mvp.model.GetMemberBodyDataModel;

/**
 * Created by 71468 on 2017/10/20.
 */

public class GetMemberBodyDataPresenter implements GetMemberBodyDataContractor,GetMemberBodyDataContractor.Presenter {
    private View mView;
    private Model model;
    public GetMemberBodyDataPresenter(View view) {
        this.mView = view;
        this.model = new GetMemberBodyDataModel(new Listener() {
            @Override
            public void onGetDataSuccess(MemberBodyData data) {
                mView.getDataSuccess(data);
            }

            @Override
            public void onError(int errorCode, String errorMessage) {
                mView.onFail(errorCode,errorMessage);
            }

            @Override
            public void onComplete() {
                mView.onLoadFinished();
            }
        });
    }

    @Override
    public void getBodyData(String phone) {
        model.getData(phone);
    }
}
